package chapter01

object String_ {
  def main(args: Array[String]): Unit={
    //1.字符串拼接
    val name1: String = "小周"
    val name2: String = "小刘"
    println(name1 + name2)

    //2.*用于字符串复制多次拼接
    println(name1 *10)



    //3.printf 字符串，通过%传递值
    val age:Int = 20
    printf("%d岁的%s在北工搞项目",age,name1)
    println


    //4.字符串模板:通过$获取变量值
    println(raw"${name1}在北工苦苦搜寻高质量大数据project")
    println(s"${name1}在北工苦苦搜寻高质量大数据project")

    val salary:Float = 315000.00000f
    //注意，此处小数默认double，需要转换一下
    println(f"${name2}的年薪为${salary}%2.1f元")


    val sql=  s"""
         | select *
         |  from
         |    student
         |  where
         |    age > ${age}
         |  and
         |    name=${name2}
         |
         |""".stripMargin
    println(sql)







  }
}
